package com.support.android.designlibdemo;

import android.content.Intent;
import android.os.Bundle;
import com.dinajinshi.app.utils.NetworkUtils;

/**
 * Created by tukela on 2015/11/26.
 */
public class SplashActivity extends PublicBaseActivity {
    private boolean isFirst=true;
    private String ISFRIST="isfrist";
    private int intentType=0;
   private User user=new User();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        isFirst=getSharedPreferences(ISFRIST,MODE_PRIVATE).getBoolean(ISFRIST,true);
//        user= UserUtil.getUser(this);
        initView();
        startMain();
    }

    /***
     * 初始化一些系统参数
     */
    public void initView() {
        if (NetworkUtils.isConnectInternet(this))
        {
            //todo 更新数据

        }
        if (isFirst)
        {
            intentType=1;
        }
//        if (user.getName().equals(User.EMPTY))
//        {
//            intentType=1;
//            return;
//
//        }
        intentType=2;



    }




    public void startMain() {
        switch (intentType)
        {
            case 0:
                startActivity(new Intent(this,LoginActivity.class));
                break;
            case 1:
                startActivity(new Intent(this,WelcomeActivity.class));
                break;
            case 2:
                startActivity(new Intent(this,HomeActivity.class));
                break;


        }
        finish();


    }
}
